<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('招聘信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>招聘名称：</label>
                                <input type="text" name="recruitName"/>
                            </li>
                            <li>
                                <label>招聘年度：</label>
                                <input type="text" class="time-input" data-type="year" name="recruitYear"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="recruit:info:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="recruit:info:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger single disabled" onclick="$.operate.removeAll()" shiro:hasPermission="recruit:info:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('recruit:info:edit')}]];
        var removeFlag = [[${@permission.hasPermi('recruit:info:remove')}]];
        var prefix = ctx + "recruit/info";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "招聘信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'recruitId',
                    title: '招聘id',
                    visible: false
                },
                {
                    field: 'recruitName',
                    title: '招聘名称'
                },
                {
                    field: 'recruitYear',
                    title: '招聘年度',
                    sortable: true
                },
                {
                    field: 'contentCount',
                    title: '招聘岗位数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="content(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'planCount',
                    title: '招聘计划数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="content(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'userCount',
                    title: '报名人数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="user(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'writtenCount',
                    title: '笔试人数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="written(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'interviewCount',
                    title: '面试人数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="interview(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'confirmCount',
                    title: '到岗人数',
                    formatter: function (value, row, index){
                        return '<a href="javascript:void(0)" onclick="confirm(\'' + row.recruitId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.recruitId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.recruitId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        /**
         * 招聘计划
         * @param recruitId
         */
        function content(recruitId){
            var url = ctx + 'recruit/content/' + recruitId;
            $.modal.openTab("招聘计划", url);
        }

        /**
         * 报名人员
         * @param recruitId
         */
        function user(recruitId){
            var url = ctx + 'recruit/user/' + recruitId;
            $.modal.openTab("报名人员", url);
        }

        /**
         * 笔试人员
         * @param recruitId
         */
        function written(recruitId){
            var url = ctx + 'recruit/written/' + recruitId;
            $.modal.openTab("笔试人员", url);
        }

        /**
         * 面试人员
         * @param recruitId
         */
        function interview(recruitId){
            var url = ctx + 'recruit/interview/' + recruitId;
            $.modal.openTab("面试人员", url);
        }

        /**
         * 到岗人员
         * @param recruitId
         */
        function confirm(recruitId){
            var url = ctx + 'recruit/confirm/' + recruitId;
            $.modal.openTab("到岗人员", url);
        }
    </script>
</body>
</html>